import { request } from "./request";

export function getCateList(params) { 
    return request({
        method: "get",
        url: "categories",
        params,
    })
 }

 export function addCatePost(data){
     return request({
         method: "post",
         url: "categories",
         data,
     })
 }

 export function deleteCate(id){
     return request({
         method: "delete",
         url: `categories/${id}`
     })
 }

 
 export function getParams(payload) { 
  return request({
      method: "get",
      url: `categories/${payload.id}/attributes`,
      params: payload.params,
  })
}

// 添加参数的请求
export function putParams(params){
    return request({
        method: "post",
        url: `categories/${params.id}/attributes`,
        data: params.data
    })
}

// 根据ID查询参数
export function selectParamsById(params) { 
    return request({
        method: "get",
        url: `categories/${params.id}/attributes/${params.attr_id}`,
        params: params.params
    })
}


//提交根据ID查询到的参数的修改信息
export function changeParamsById(params){
    return request({
        method: "put",
        url: `categories/${params.id}/attributes/${params.attrId}`,
        data: params.data
    })
}
//删除参数
export function deleteParamsById(params){
    return request({
        method: "delete",
        url: `categories/${params.id}/attributes/${params.attrId}`,
    })
}


// 获取商品列表的数据
export function getGoodsList(params) { 
    return request({
        method: "get",
        url: `goods`,
        params,
    })
 }
 